package com.wurao.test.agency;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class Meipo implements InvocationHandler {
    private Person target;
    public Object getInstance(Person target)throws Exception{
        this.target=target;
        Class clazz=target.getClass();
        return Proxy.newProxyInstance(clazz.getClassLoader(),clazz.getInterfaces(),this);
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("进来了");
         //this.target.findLove();
        method.invoke(this.target,args);
        System.out.println("恭喜找到合适的对象！");
        return null;
    }
}
